﻿using Bootstrap.Helper;
using Bootstrap.Template.Thumbnail;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Bootstrap.Control
{
    public class BootstrapThumbnail : WebControl
    {
        #region Properties

        public string ImageUrl { get; set; }
        public string Text { get; set; }
        public string HeaderText { get; set; }
        public string OnClientClick { get; set; }

        #endregion

        #region Methods

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            BootstrapThumbnailTemplate template = new BootstrapThumbnailTemplate();

            template.ImageUrl = ValueHelper.GetDefaultValue<string>(this.ImageUrl, "images\\ImageNotAvailable.jpg");
            template.Text = ValueHelper.GetDefaultValue<string>(this.Text, string.Empty);
            template.HeaderText = ValueHelper.GetDefaultValue<string>(this.HeaderText, string.Empty);
            template.OnClientClick = ValueHelper.GetDefaultValue<string>(this.OnClientClick, string.Empty);

            writer.Write(template.TransformText());
        }

        #endregion

    }
}
